package com.wiscamp.ninechapters.problems.infrastructure.converters;

import com.wiscamp.ninechapters.problems.domain.models.collections.CollectionPart;
import com.wiscamp.ninechapters.problems.domain.models.collections.CollectionProblem;
import com.wiscamp.ninechapters.problems.domain.models.collections.CollectionSection;
import com.wiscamp.ninechapters.problems.domain.models.collections.ProblemCollection;
import com.wiscamp.ninechapters.problems.infrastructure.po.collections.*;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface ProblemCollectionConverter {
    ProblemCollectionConverter Instance = Mappers.getMapper(ProblemCollectionConverter.class);

    // region collection
    ProblemCollectionPO toProblemCollectionPO(ProblemCollection entity);

    ProblemCollectionPO toProblemCollectionPO(ProblemCollection entity, @MappingTarget ProblemCollectionPO po);

    ProblemCollection toProblemCollection(ProblemCollectionPO po);

    ProblemCollection toProblemCollectionByView(ProblemCollectionView view);
    // endregion

    // region collection problem
    CollectionProblemPO toCollectionProblemPO(CollectionProblem entity);

    CollectionProblemPO toCollectionProblemPO(CollectionProblem entity, @MappingTarget CollectionProblemPO po);

    CollectionProblem toCollectionProblem(CollectionProblemPO po);
    // endregion

    // region collection part
    CollectionPartPO toCollectionPartPO(CollectionPart entity);

    CollectionPartPO toCollectionPartPO(CollectionPart entity, @MappingTarget CollectionPartPO po);

    CollectionPart toCollectionPart(CollectionPartPO po);
    // endregion

    // region collection section
    CollectionSectionPO toCollectionSectionPO(CollectionSection entity);

    CollectionSectionPO toCollectionSectionPO(CollectionSection entity, @MappingTarget CollectionSectionPO po);

    CollectionSection toCollectionSection(CollectionSectionPO po);
    // endregion
}
